fix: use named import for @babel/generator to fix bundled codegen crash#477
Merged
danadajian merged 1 commit intomainfrom May 5, 2026
Merged
fix: use named import for @babel/generator to fix bundled codegen crash#477danadajian merged 1 commit intomainfrom
danadajian merged 1 commit intomainfrom
Conversation
The rolldown bundler calls __toESM with isNodeMode=1 for default imports, which sets .default to the entire exports object rather than the actual generate function. Switching to the named export avoids this path and resolves the TypeError at runtime. Also updates the CLI CI job to run the built dist artifact instead of the TypeScript source directly, so this class of bundler regression is caught before release. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🎉 This PR is included in version 2.5.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@babel/generatorexports itsgeneratefunction as both a default and named export. When bundled with rolldown (viatsdown), default imports go through an__toESMhelper withisNodeMode=1, which sets.defaultto the entire exports object rather than the actual function — causingTypeError: (0, import_lib$2.default) is not a functionat runtime.{ generate }import avoids this code path and resolves the crash.bun src/cli.ts, which bypasses the bundler entirely. It has been updated to run from the builtdist/cli.mjsso bundler regressions like this are caught before release.Changes
Test plan
bun run buildcompletes without errorsbun dist/cli.mjs --testingType e2eoutputsCodegen complete!bun dist/cli.mjs --testingType componentoutputsCodegen complete!clijob passes end-to-endGenerated with Claude Code